package com.hulu.yec.sys.user.entity;

import java.util.Date;

import com.hulu.yec.common.annotation.Column;

/**
 * 管理员实体（初次构建，可以提出公共模板）
 * 
 * @author hf 2016年3月6日
 */
public class SysUserEntity {
	private int id;
	private String code;
	private String password;
	private String name;
	// '性别：1、男；2、女。
	private int sex;
	private String phone;
	private String email;
	@Column("create_time")
	private Date createTime;
	// 对应用户表的id
	@Column("operate_user_id")
	private int operateUserId;
	@Column("operate_time")
	private Date operateTime;
	// 对应角色表的id
	@Column("role_id")
	private int roleId;
	// 学员所属班级：对应班级表里的id
	@Column("class_id")
	private int classId;
	// 状态：1、有效；2、无效。
	private int state;
	private String memo;

	/**
	 * 附加属性
	 */
	@Column("sys_role.name")
	private String roleName;
	@Column("sys_role.state")
	private int roleState;

	@Column("sys_class.name")
	private String className;
	@Column("sys_class.state")
	private int classState;

	/**
	 * setter and getter
	 */
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSex() {
		return sex;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}

	public String getSexStr() {
		if (sex == 2) {
			return "女";
		} else {
			return "男";
		}
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public int getOperateUserId() {
		return operateUserId;
	}

	public void setOperateUserId(int operateUserId) {
		this.operateUserId = operateUserId;
	}

	public Date getOperateTime() {
		return operateTime;
	}

	public void setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
	}

	public int getRoleId() {
		return roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	public int getClassId() {
		return classId;
	}

	public void setClassId(int classId) {
		this.classId = classId;
	}

	public String getStateStr() {
		if (state == 1) {
			return "有效";
		} else if (state == 2) {
			return "无效";
		} else {
			return "";
		}
	}

	public String getReStateStr() {
		if (state == 1) {
			return "无效";
		} else if (state == 2) {
			return "有效";
		} else {
			return "";
		}
	}

	public String getClassStr() {
		if (state == 1) {
			return "无效";
		} else if (state == 2) {
			return "有效";
		} else {
			return "";
		}
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public int getRoleState() {
		return roleState;
	}

	public void setRoleState(int roleState) {
		this.roleState = roleState;
	}

	public int getClassState() {
		return classState;
	}

	public void setClassState(int classState) {
		this.classState = classState;
	}

	@Override
	public String toString() {
		return "SysUserEntity [id=" + id + ", code=" + code + ", password=" + password + ", name=" + name + ", sex="
				+ sex + ", phone=" + phone + ", email=" + email + ", createTime=" + createTime + ", operateUserId="
				+ operateUserId + ", operateTime=" + operateTime + ", roleId=" + roleId + ", classId=" + classId
				+ ", state=" + state + ", memo=" + memo + ", roleName=" + roleName + ", className=" + className + "]";
	}

}
